package com.ruoyi.basedocument.service.impl;

import java.util.List;

import com.ruoyi.basedocument.domain.BomCustomer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.basedocument.mapper.BomAsscategoryMapper;
import com.ruoyi.basedocument.domain.BomAsscategory;
import com.ruoyi.basedocument.service.IBomAsscategoryService;

/**
 * BOM类别关联Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-09-23
 */
@Service
public class BomAsscategoryServiceImpl implements IBomAsscategoryService 
{
    @Autowired
    private BomAsscategoryMapper bomAsscategoryMapper;

    /**
     * 查询BOM类别关联
     * 
     * @param id BOM类别关联主键
     * @return BOM类别关联
     */
    @Override
    public BomAsscategory selectBomAsscategoryById(String id)
    {
        return bomAsscategoryMapper.selectBomAsscategoryById(id);
    }

    /**
     * 查询BOM类别关联列表
     * 
     * @param bomAsscategory BOM类别关联
     * @return BOM类别关联
     */
    @Override
    public List<BomAsscategory> selectBomAsscategoryList(BomAsscategory bomAsscategory)
    {
        return bomAsscategoryMapper.selectBomAsscategoryList(bomAsscategory);
    }

    /**
     * 查询BOM类别关联列表
     *
     * @param bomAsscategory BOM类别关联
     * @return BOM类别关联
     */
    @Override
    public List<BomAsscategory> selectBomAsscategoryList2(BomAsscategory bomAsscategory)
    {
        return bomAsscategoryMapper.selectBomAsscategoryList2(bomAsscategory);
    }

    /**
     * 查询BOM类别关联列表
     *
     * @param bomAsscategory BOM类别关联
     * @return BOM类别关联
     */
    @Override
    public List<BomAsscategory> selectBomAsscategoryList3(BomAsscategory bomAsscategory)
    {
        return bomAsscategoryMapper.selectBomAsscategoryList3(bomAsscategory);
    }

    /**
     * 新增BOM类别关联
     * 
     * @param bomAsscategory BOM类别关联
     * @return 结果
     */
    @Override
    public int insertBomAsscategory(BomAsscategory bomAsscategory)
    {
        BomAsscategory obj = new BomAsscategory();
        obj.setMaterialbomnumber(bomAsscategory.getMaterialbomnumber());
        List<BomAsscategory> objs = selectBomAsscategoryList2(obj);
        if(objs!=null&&objs.size()!=0){
            throw new RuntimeException("编码已存在:"+bomAsscategory.getMaterialbomnumber());
        }
        return bomAsscategoryMapper.insertBomAsscategory(bomAsscategory);
    }

    /**
     * 修改BOM类别关联
     * 
     * @param bomAsscategory BOM类别关联
     * @return 结果
     */
    @Override
    public int updateBomAsscategory(BomAsscategory bomAsscategory)
    {
        return bomAsscategoryMapper.updateBomAsscategory(bomAsscategory);
    }

    /**
     * 批量删除BOM类别关联
     * 
     * @param ids 需要删除的BOM类别关联主键
     * @return 结果
     */
    @Override
    public int deleteBomAsscategoryByIds(String[] ids)
    {
        return bomAsscategoryMapper.deleteBomAsscategoryByIds(ids);
    }

    /**
     * 删除BOM类别关联信息
     * 
     * @param id BOM类别关联主键
     * @return 结果
     */
    @Override
    public int deleteBomAsscategoryById(String id)
    {
        return bomAsscategoryMapper.deleteBomAsscategoryById(id);
    }
}
